//--------------------------------------------------------------------------------
// Name: CMap.h
// Desc: A graphical library for using large scrolling in Opengl
// Author : Patrick Maba
//
//--------------------------------------------------------------------------------
#ifndef CMAP_H
#define CMAP_H
#include <GL/glaux.h>



#include "Tile.h"

class CMap 
{
public:
	CMap(const char *FileTextName);
	~CMap(void);
   void DrawMap(void);
   void ScrollLeft(int npixel=1);
   void ScrollRight(int npixel=1);
   void ScrollDown(int npixel=1);
   void ScrollUp(int npixel=1);
   void LoadBaseFile(const char* FileTextName);

public:
    int GetBlock(int Xpos, int Ypos);   
   void StartMap(int XBlockArrayPos, int YBlockArrayPos);
   void GetResolution(int _ResolX, int _ResolY);
   char *substr( char *s1, int startpos, int len );
   void InitFail(LPCTSTR szError );
   void save(void);

public:	
   int MAXCOLS; // is the total number of columns of blocks in map.
   int MAXROWS; // is the total number of rows of blocks in map.
   int MAXTILES; // is the total tile used in map.
   int *LevelMap; // Array to construct a level out of the blocks.   
   int XOffset; // coordonate upper left of the Visible screen in the Map
   int YOffset;
   //CTile Tile; // Tile objet to manage the blocks.
   int ScreenWidth; // Lenght of the current resolution. 
   int ScreenHeight; // Height of the current resolution. 
   int TotWidthInPixel; // Total width in pixel of Map
   int TotHeightInPixel; // Total height in pixel of Map
   int xTileStart; // keep the current column block position in the array LevelMap.
   int yTileStart; // keep the current row block position in the array LevelMap.
   int ScreenMAPWidth;
   int ScreenMAPHeight;
   int ResolX;
   int ResolY;

};

#endif

